/*
 * Grupo:		Danilo Beraldo Ireno
 * 				Flavio Augusto de Mello
 * 				Giuliano G. Maranha
 * 				Luis Fernando Junior
 *
 * Disciplina: 	Compiladores
 * Professor:	Dr. Eraldo Pereira Marinho*
 */

#include <stdlib.h>
#include <stdio.h>
#include "lexer.h"
#include "keywords.h"
#include "tokens.h"
#include "asmgen.h"


 //Return the name of the token
char *tokenname(int token) {
              return gettokenname(token-BEGIN); /* This function can be found on keywords.c */

}


void error(int expected,  int token , int line) {
	if(token < 16385){
				printf("token mismatch - ");
				printf("expected '%d' and found '%s' at line %d\n",expected,lexeme,line);
				exit(-1);
	}else{
	    printf("token mismatch - ");
        printf("expected '%s' and found '%s' at line %d\n",tokenname(expected),tokenname(token),line);
        exit(-1);
	}
}
